<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%
    String user_id = request.getSession().getAttribute("user_id") == null
					? ""
					: request.getSession().getAttribute("user_id").toString();
String role_name = request.getSession().getAttribute("role_name") == null ? ""
	    : request.getSession().getAttribute("role_name").toString();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../../css/header.css">
</head>
<body>
	<div id="header">
		<div class="top">
			<div></div>
			<a href="#" target="_self" style="float: left">联系我们
				电话：029-85309181 邮箱：yjy@sxrcfz.org</a><span style="float: left"></span>
			<div id="headlogin">
				<a href="../common/login.jsp" target="_self" style="float: right">登录</a>
				<span style="float: left"></span>
			</div>
			<div id="register">
				<a href="../common/register.jsp" target="_self" style="float: right">注册</a>
				<span style="float: left"></span>
			</div>
			<a href="../common/usermessage.jsp" target="_self" style="float: right">用户建议</a>
			<span style="float: left"> </span> 
			<a href="../common/handbook.jsp" target="_self" style="float: right">帮助中心</a>
			<span style="float: left"> </span>
			<!--             <a href="../common/question.jsp" target="_self" style="float:right">问题咨询</a><span style="float:left">      </span>
 -->
			<a href="../common/about.jsp" target="_self" style="float: right">关于我们</a><span
				style="float: left"> </span> <a href="http://www.sxrcfz.org/"
				target="_blank" style="float: right">研究院主页</a><span
				style="float: left"> </span>
		</div>

		<div style="margin: 0 auto; height: 200px; width: 100%">
			<a><img style="width: 100%" src="../../image/top.jpg"></a>
		</div>
		<div class="topNav">
			<ul>
				<li><a href="../information/getInformation" target="_self">首页</a></li>
				<li><a href="../information/getinfosearchview" target="_self">知识搜索</a></li>
				<li><a href="../information/p_getuploadview" target="_self">知识上传</a></li>
				<li><a href="../message/getMessageview" target="_self">知识问答</a></li>
				<li><a href="../specialist/getSpecialistview" target="_self">专家黄页</a></li>
				<li><a href="../infocenter/getinfocenter" target="_self">个人中心</a></li>
			</ul>
		</div>
	</div>
	<script type="text/javascript">
    var user_id='<%=user_id%>';
    var role_name='<%=role_name%>'
		$(function() {
			if (user_id != "") {
				var content = "<a onclick='logout()'  style='float:right;color:white'>退出</a>"
				        + "<span style='float:right;color:white'>欢迎&nbsp;&nbsp;"
						+ "<span style='color:yellow'>"
						+ user_id
						+ "</span>";
				if(role_name=="专家"){
					$.ajax({
						async : false,
						cache : false,
						type : 'POST',
						dataType : "json",
						data : {
							"userid" : user_id
						},
						url : "../message/getMessageNoReply",
						error : function() {
							alert('请求失败');
						},
						success : function(data) {
							content += "<a id='' style='color:red;margin-left:5px' data-toggle='popover' data-trigger='hover' title='尊敬的专家，您有"+data+"条问题待回答'>(<span id='noreplycount'>"+data+"</span>条问题)</a>&nbsp;&nbsp</span>";
						}
					});//AJAX结束
				}
				else content +="&nbsp;&nbsp</span>";
				$("#headlogin").empty();
				$("#headlogin").append(content);
				$("#register").empty();
			}
			
		})
		function logout() {
			$.ajax({
				url : "../permission/loginout?tmp=" + Math.random(),
				async : true,
				success : function(result) {
					if (result == 1)
						window.location = "../information/getInformation";
				}
			});
		}
	</script>
</body>
</html>